package girafPlace.Admin;

import java.security.MessageDigest;

public class Password {

	private String password = null;
	
	public String getpass(char[] passfield){
	
		try{
			MessageDigest md = MessageDigest.getInstance( "MD5" );
			byte[] bytepass = md.digest(new String(passfield).getBytes("UTF-8"));
						
			StringBuffer passbuff = new StringBuffer();
			  for( int i=0; i<bytepass.length; i++ )     
			  {
			     byte b = bytepass[i];
			     String hexpass = Integer.toHexString((int) 0x00FF & b);
			     if (hexpass.length() == 1) 
			     {
			        passbuff.append("0");
			     }
			     passbuff.append(hexpass);
			  }
			String converter = new String(passbuff);  
			password = converter;
		} catch(Exception ebyte){
			ebyte.printStackTrace();
		}
	
		return password;
	}
}
